home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / grizzly-adventure.swf / scripts / Grizzly.as < prev   
Encoding:
Text File  |  2011-10-17  |  9.6 KB  |  308 lines

  1. package
  2. {
  3.    import flash.accessibility.*;
  4.    import flash.debugger.*;
  5.    import flash.display.*;
  6.    import flash.errors.*;
  7.    import flash.events.*;
  8.    import flash.external.*;
  9.    import flash.filters.*;
  10.    import flash.geom.*;
  11.    import flash.media.*;
  12.    import flash.net.*;
  13.    import flash.printing.*;
  14.    import flash.profiler.*;
  15.    import flash.system.*;
  16.    import flash.text.*;
  17.    import flash.ui.*;
  18.    import flash.utils.*;
  19.    import flash.xml.*;
  20.    import jadeware.*;
  21.    import mx.binding.*;
  22.    import mx.core.Application;
  23.    import mx.core.UIComponent;
  24.    import mx.core.UIComponentDescriptor;
  25.    import mx.core.mx_internal;
  26.    import mx.events.FlexEvent;
  27.    import mx.styles.*;
  28.    
  29.    use namespace mx_internal;
  30.    
  31.    public class Grizzly extends Application
  32.    {
  33.       
  34.       mx_internal static var _Grizzly_StylesInit_done:Boolean = false;
  35.        
  36.       
  37.       private var _embed_css____embeddatas_gfx_bgmenu_png_790785447:Class;
  38.       
  39.       private var _embed_css____embeddatas_gfx_w2bg_png_22127145:Class;
  40.       
  41.       private var _documentDescriptor_:UIComponentDescriptor;
  42.       
  43.       private var _gui:UIComponent;
  44.       
  45.       public function Grizzly()
  46.       {
  47.          _documentDescriptor_ = new UIComponentDescriptor({
  48.             "type":Application,
  49.             "propertiesFactory":function():Object
  50.             {
  51.                return {
  52.                   "width":624,
  53.                   "height":480
  54.                };
  55.             }
  56.          });
  57.          _embed_css____embeddatas_gfx_bgmenu_png_790785447 = Grizzly__embed_css____embeddatas_gfx_bgmenu_png_790785447;
  58.          _embed_css____embeddatas_gfx_w2bg_png_22127145 = Grizzly__embed_css____embeddatas_gfx_w2bg_png_22127145;
  59.          super();
  60.          mx_internal::_document = this;
  61.          if(!this.styleDeclaration)
  62.          {
  63.             this.styleDeclaration = new CSSStyleDeclaration();
  64.          }
  65.          this.styleDeclaration.defaultFactory = function():void
  66.          {
  67.             this.backgroundColor = 0;
  68.             this.backgroundAlpha = 0;
  69.          };
  70.          mx_internal::_Grizzly_StylesInit();
  71.          this.layout = "absolute";
  72.          this.width = 624;
  73.          this.height = 480;
  74.          this.clipContent = false;
  75.          this.addEventListener("applicationComplete",___Grizzly_Application1_applicationComplete);
  76.       }
  77.       
  78.       public function addChildGameAt(param1:*, param2:int) : void
  79.       {
  80.          if(param1 != null)
  81.          {
  82.             _gui.addChildAt(param1,param2);
  83.          }
  84.       }
  85.       
  86.       public function setMenu() : void
  87.       {
  88.          var _loc1_:ContextMenuItem = new ContextMenuItem("Powered by JadeGame.com");
  89.          _loc1_.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,menuItemSelected);
  90.          var _loc2_:ContextMenu = new ContextMenu();
  91.          _loc2_.hideBuiltInItems();
  92.          _loc2_.addEventListener(ContextMenuEvent.MENU_SELECT,menuSelectHandler);
  93.          _loc2_.customItems.push(_loc1_);
  94.          application.contextMenu = _loc2_;
  95.       }
  96.       
  97.       public function BringToFront(param1:*) : void
  98.       {
  99.          _gui.setChildIndex(param1,_gui.numChildren - 1);
  100.       }
  101.       
  102.       public function ___Grizzly_Application1_applicationComplete(param1:FlexEvent) : void
  103.       {
  104.          AppMain();
  105.       }
  106.       
  107.       public function getGameURL() : String
  108.       {
  109.          var _loc1_:String = String(Application.application.url);
  110.          var _loc2_:Array = _loc1_.split("://");
  111.          var _loc3_:Array = _loc2_[1].split("/");
  112.          return String(_loc3_[0]);
  113.       }
  114.       
  115.       public function setSitelock() : Boolean
  116.       {
  117.          var _loc1_:String = getGameURL();
  118.          if(_loc1_ == null || _loc1_ == "")
  119.          {
  120.             return false;
  121.          }
  122.          if(_loc1_ != "jadegame.com" && _loc1_ != "www.jadegame.com" && _loc1_ != "flashgamelicense.com" && _loc1_ != "www.flashgamelicense.com")
  123.          {
  124.             Application.application.alpha = 0;
  125.             return true;
  126.          }
  127.          return false;
  128.       }
  129.       
  130.       public function removeChildGame(param1:*) : void
  131.       {
  132.          if(param1 != null)
  133.          {
  134.             _gui.removeChild(param1);
  135.          }
  136.       }
  137.       
  138.       private function menuItemSelected(param1:ContextMenuEvent) : void
  139.       {
  140.          navigateToURL(new URLRequest("http://www.jadegame.com"),"_blank");
  141.       }
  142.       
  143.       private function menuSelectHandler(param1:ContextMenuEvent) : void
  144.       {
  145.       }
  146.       
  147.       override public function initialize() : void
  148.       {
  149.          mx_internal::setDocumentDescriptor(_documentDescriptor_);
  150.          super.initialize();
  151.       }
  152.       
  153.       public function addChildGame(param1:*) : void
  154.       {
  155.          if(param1 != null)
  156.          {
  157.             _gui.addChild(param1);
  158.          }
  159.       }
  160.       
  161.       private function AppMain() : void
  162.       {
  163.          _gui = new UIComponent();
  164.          _gui.setStyle("backgroundColor","#000000");
  165.          _gui.setStyle("backgroundAlpha",0);
  166.          this.addChild(_gui);
  167.          setMenu();
  168.          jadeAPI.Initialize();
  169.          jadeAPI.setHit();
  170.          new LogicManager().InitPres();
  171.       }
  172.       
  173.       public function get gui() : UIComponent
  174.       {
  175.          return _gui;
  176.       }
  177.       
  178.       mx_internal function _Grizzly_StylesInit() : void
  179.       {
  180.          var style:CSSStyleDeclaration = null;
  181.          var effects:Array = null;
  182.          if(mx_internal::_Grizzly_StylesInit_done)
  183.          {
  184.             return;
  185.          }
  186.          mx_internal::_Grizzly_StylesInit_done = true;
  187.          style = StyleManager.getStyleDeclaration("Canvas");
  188.          if(!style)
  189.          {
  190.             style = new CSSStyleDeclaration();
  191.             StyleManager.setStyleDeclaration("Canvas",style,false);
  192.          }
  193.          if(style.factory == null)
  194.          {
  195.             style.factory = function():void
  196.             {
  197.                this.color = 0;
  198.                this.fontWeight = "bold";
  199.                this.backgroundImage = _embed_css____embeddatas_gfx_w2bg_png_22127145;
  200.                this.backgroundSize = "100%";
  201.             };
  202.          }
  203.          style = StyleManager.getStyleDeclaration(".TextMenu");
  204.          if(!style)
  205.          {
  206.             style = new CSSStyleDeclaration();
  207.             StyleManager.setStyleDeclaration(".TextMenu",style,false);
  208.          }
  209.          if(style.factory == null)
  210.          {
  211.             style.factory = function():void
  212.             {
  213.                this.color = 16777215;
  214.             };
  215.          }
  216.          style = StyleManager.getStyleDeclaration(".PresCanvas");
  217.          if(!style)
  218.          {
  219.             style = new CSSStyleDeclaration();
  220.             StyleManager.setStyleDeclaration(".PresCanvas",style,false);
  221.          }
  222.          if(style.factory == null)
  223.          {
  224.             style.factory = function():void
  225.             {
  226.                this.color = 0;
  227.                this.fontWeight = "bold";
  228.                this.backgroundImage = _embed_css____embeddatas_gfx_bgmenu_png_790785447;
  229.                this.backgroundSize = "100%";
  230.             };
  231.          }
  232.          style = StyleManager.getStyleDeclaration("Alert");
  233.          if(!style)
  234.          {
  235.             style = new CSSStyleDeclaration();
  236.             StyleManager.setStyleDeclaration("Alert",style,false);
  237.          }
  238.          if(style.factory == null)
  239.          {
  240.             style.factory = function():void
  241.             {
  242.                this.borderColor = 5861536;
  243.                this.footerColors = [10335961,16777215];
  244.                this.titleStyleName = "ΓÇ£alertTitleΓÇ¥";
  245.                this.color = 995703;
  246.                this.cornerRadius = 6;
  247.                this.dropShadowEnabled = true;
  248.                this.headerColors = [9479377,5861536];
  249.                this.headerHeight = 19;
  250.                this.dropShadowColor = 13753847;
  251.                this.borderThickness = 1;
  252.                this.borderStyle = "solid";
  253.                this.backgroundColor = 16777215;
  254.             };
  255.          }
  256.          style = StyleManager.getStyleDeclaration("Application");
  257.          if(!style)
  258.          {
  259.             style = new CSSStyleDeclaration();
  260.             StyleManager.setStyleDeclaration("Application",style,false);
  261.          }
  262.          style = StyleManager.getStyleDeclaration(".MenuCanvas");
  263.          if(!style)
  264.          {
  265.             style = new CSSStyleDeclaration();
  266.             StyleManager.setStyleDeclaration(".MenuCanvas",style,false);
  267.          }
  268.          if(style.factory == null)
  269.          {
  270.             style.factory = function():void
  271.             {
  272.                this.color = 0;
  273.                this.fontWeight = "bold";
  274.                this.backgroundImage = _embed_css____embeddatas_gfx_bgmenu_png_790785447;
  275.                this.backgroundSize = "100%";
  276.             };
  277.          }
  278.          style = StyleManager.getStyleDeclaration(".alertTitle");
  279.          if(!style)
  280.          {
  281.             style = new CSSStyleDeclaration();
  282.             StyleManager.setStyleDeclaration(".alertTitle",style,false);
  283.          }
  284.          if(style.factory == null)
  285.          {
  286.             style.factory = function():void
  287.             {
  288.                this.textAlign = "left";
  289.                this.color = 16777215;
  290.                this.fontWeight = "bold";
  291.                this.fontSize = 10;
  292.                this.fontFamily = "Verdana";
  293.             };
  294.          }
  295.          StyleManager.mx_internal::initProtoChainRoots();
  296.       }
  297.       
  298.       public function numChildrenGame() : int
  299.       {
  300.          if(_gui == null)
  301.          {
  302.             return 0;
  303.          }
  304.          return _gui.numChildren;
  305.       }
  306.    }
  307. }
  308.